<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="Adven">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
 <link rel="shortcut icon" href="http://www.golaravel.com/assets/favicon.ico" />      
  <title>ajax请求测试</title>
 </head>
 <body>
 <button id="btn" type="">点击发送AJAX请求 </button>

<!--原生AJAX   -->
 <script  type="text/javascript" charset="utf-8" >
 	var btn=document.getElementById('btn');
 	btn.onclick=function(){
 		var x=new XMLHttpRequest();
 		x.onreadystatechange=function(){
 			if (x.readyState==4 && x.status==200) {
 				 alert(x.responseText);
 			}
 		}
 		x.open('GET','/dev/ajax',true);
 		//CSRF
 		x.setRequestHeader('content-type','application/x-www-form-urlencoded');
 		x.send('_token={{csrf_token()}}&user=admin');
 	}
 </script>
  
 </body>
</html>
